﻿app.controller("ngUserRegistrationController", function ($scope, $http, $location) {
    $scope.pageClassAni = 'page-register';
    $scope.NewUser = function (user) {
        $http.post("/api/Account/Register",user).success(function () {
            console.log("User Successfully Registered.");
            $location.path("/");
            }).error(function (data) {
                console.log(JSON.stringify(data))
            });
    }
});
app.directive('match', function () {
    return {
        require: 'ngModel',
        restrict: 'A',
        scope: {
            match: '='
        },
        link: function (scope, elem, attrs, ctrl) {
            scope.$watch(function () {
                var modelValue = ctrl.$modelValue || ctrl.$$invalidModelValue;
                return (ctrl.$pristine && angular.isUndefined(modelValue)) || scope.match === modelValue;
            }, function (currentValue) {
                ctrl.$setValidity('match', currentValue);
            });
        }
    };
});